<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
    <title>申请详情</title>
</head>
<body>

<script type="text/javascript" src="./$.js"></script>
<script>
    require(['!this.js'], $$.load)
</script>
</body>
</html>

<!--tpl部分-->
<template data-name="this.htm">
    <div class="add" v-if="data">
        <a class="info" href="mylist.html">
            <img :src="data.avatar">
            <div class="rightinfo">
                <div class="infoperson">
                    <p>{{data.name}}</p>
                    <p>{{data.dept}}</p>
                </div>
                <div class="infowork">
                    <span>已补签</span>
                    <div class="num">{{data.count}}</div>
                    <span>{{data.mobile}}</span>
                </div>
            </div>
            <div class="addSangle"><img src="../$res/imgers/into.png"></div>
        </a>

        <div class="buqian_content">
            <div class="content">
                <div class="weui-cell__bd myweui-cell" >
                    <div class="weui-input my-weui-input">{{data.create_time}}</div>
                </div>
                <div class="weui-cell__bd mytextarea">
                    <textarea class="weui-textarea my-weui-textarea" readonly="readonly" placeholder="请输入文本" rows="3" v-model="data.reason"></textarea>
                </div>
            </div>
        </div>

        <div v-if="data.status==0">
            <div class="weui-btn-area" @click="sp_check(1,data.id)">
                <a class="weui-btn weui-btn_primary" href="javascript:">同意</a>
            </div>
            <div class="weui-btn-area" @click="sp_check(-1,data.id)">
                <a class="weui-btn weui-btn_warn" href="javascript:;">拒绝</a>
            </div>
            <div class="spmessage"></div>
        </div>

        <div v-if="data.status==1">
            <div class="buqian_content">
                <div class="content">
                    <div class="my"></div>
                    <div class="weui-cells">
                        <div class="weui-cell myweui-cell-detail">
                            <div class="weui-cell__bd">
                                <p>审批人</p>
                            </div>
                            <div class="weui-cell__ft">{{data.sp_name}}</div>
                        </div>
                        <div class="weui-cell myweui-cell-detail">
                            <div class="weui-cell__bd">
                                <p>审批时间</p>
                            </div>
                            <div class="weui-cell__ft">{{data.sp_time}}</div>
                        </div>
                        <div class="weui-cell myweui-cell-detail">
                            <div class="weui-cell__bd">
                                <p>审批结果</p>
                            </div>
                            <div class="weui-cell__ft">通过</div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div v-if="data.status==-1">
            <div class="buqian_content">
                <div class="content">
                    <div class="my"></div>
                    <div class="weui-cells">
                        <div class="weui-cell myweui-cell">
                            <div class="weui-cell__bd">
                                <p>审批人</p>
                            </div>
                            <div class="weui-cell__ft">{{data.sp_name}}</div>
                        </div>
                        <div class="weui-cell myweui-cell">
                            <div class="weui-cell__bd">
                                <p>审批时间</p>
                            </div>
                            <div class="weui-cell__ft">{{data.sp_time}}</div>
                        </div>
                        <div class="weui-cell myweui-cell">
                            <div class="weui-cell__bd">
                                <p>审批结果</p>
                            </div>
                            <div class="weui-cell__ft">拒绝</div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>

<!--JS部分-->
<script data-name="this.js">

    function get_person_info() {
        $$.ajax({
            url: "/kaoqin/apply/get_supply",
            data: {
                id: web.c.query.userid
            },
            result: {
                $200: function (ret) {
                    weui.loading().hide();
                    $$.m.data = ret.data;
                }
            }
        });
    }

    require('../$res/js/common');
    module.exports = {
        template: require('!this.htm'),
        methods: {
            sp_check:function (status,id) {
                weui.loading('审核中');
                $$.ajax({
                    url: "/kaoqin/apply/sp_supply",
                    data: {
                        id:id,
                        status:status
                    },
                    result: {
                        $200: function (data) {
                            weui.loading().hide();
                            weui.toast('审核成功',function () {
                                window.history.back();
                            },500);
                        }
                    }
                });
            }
        },
        loaded: function () {
            $$.m = {
                data: false
            };
            weui.loading('加载中');
        },
        mounted: function () {
            get_person_info();
        }
    };

</script>